package com.withyou.euraka.provide.service;
import java.util.Date;
import java.util.List;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import com.withyou.euraka.provide.entity.UserEntity;
import com.withyou.euraka.provide.util.DateUtil;
@Slf4j
@Service
public class UserInfoService {
	
	@Autowired
	private MongoTemplate mongoTemplate;
	
	public List<UserEntity> getAllUser(){
		log.info("UserInfoService.getAllUser"+DateUtil.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss"));
		return mongoTemplate.findAll(UserEntity.class);
	}

	public void insertUser(UserEntity userInfo) {
		log.info("UserInfoService.insertUser"+DateUtil.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss"));
		mongoTemplate.save(userInfo);
	}
	
}
